package com.zzq.subservice.impl;

import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.zzq.annotation.SubService;
import com.zzq.domain.entity.SmileClientDelivery;
import com.zzq.service.SmileClientDeliveryService;
import com.zzq.subservice.ClientDeliverySubService;
import com.zzq.util.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;

@SubService
public class ClientDeliverySubServiceImpl implements ClientDeliverySubService {

    @Autowired
    SmileClientDeliveryService clientDeliveryService;
    @Override
    /**
     * 修改地址
     * @param clientId
     * @param clientDeliveryId
     */
    public void  updDefaultAddress(Long clientId){
        LambdaUpdateWrapper<SmileClientDelivery> updateWrapper=new LambdaUpdateWrapper();
        updateWrapper.eq(SmileClientDelivery::getClientId,clientId);
        updateWrapper.eq(SmileClientDelivery::getDefaultAddress,true);
        updateWrapper.set(SmileClientDelivery::getDefaultAddress,false);
        clientDeliveryService.update(updateWrapper);

    }
}
